// import { MessagePlugin } from 'tdesign-vue';
import { getAllPageRole } from '@/service/business-management/role';
import { getAllPageUser } from '@/service/business-management/users';

// 定义的state初始值
const state = {
  roleInfo: null,
  userInfo: null,
};

const mutations = {
  REQUIREALLROLEINFO(state, res) {
    state.roleInfo = res;
  },
  REQUIREALLUserINFO(state, res) {
    state.userInfo = res;
  },
};

const getters = {};

const actions = {
  async requireAllRoleInfo({ commit }, roleDTO) {
    const res = await getAllPageRole(roleDTO);
    commit('REQUIREALLROLEINFO', res);
  },
  async requireAllUserInfo({ commit }, roleDTO) {
    const res = await getAllPageUser(roleDTO);

    commit('REQUIREALLUserINFO', res);
  },
};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters,
};
